package com.ssy.lingxi.scheduler.api.model;

import com.ssy.lingxi.scheduler.api.handler.annotation.TimestampAnnotation;

import javax.validation.constraints.*;
import java.io.Serializable;
import java.util.List;
import java.util.Map;

/**
 * 创建定时任务接口参数
 * @author 万宁
 * @version 2.0.0
 * @date 2021-07-12
 */
public class ScheduleTaskVO implements Serializable {
    private static final long serialVersionUID = -5706894035161400677L;

    /**
     * 创建定时任务的服务名称，例如order-service
     */
    @NotBlank(message = "服务名称不能为空")
    @Size(max = 100, message = "服务名称最长100个字符")
    private String serviceName;

    /**
     * 定时任务执行后，调用方提供的回调接口Url
     */
    @NotBlank(message = "回调接口Url不能为空")
    @Size(message = "回调接口Url最长200个字符")
    private String callbackUrl;

    /**
     * 会员Id
     */
    @NotNull(message = "会员Id要大于0")
    @Positive(message = "会员Id要大于0")
    private Long memberId;

    /**
     * 会员角色Id
     */
    @NotNull(message = "会员角色Id要大于0")
    @Positive(message = "会员角色Id要大于0")
    private Long roleId;

    /**
     * 定时任务的参数，例如订单Id等
     */
    @NotEmpty(message = "定时任务参数列表不能为空")
    private List<Long> dataIds;

    /**
     * 任务开始执行的时间，（Unix时间戳格式，精确到毫秒）
     */
    @TimestampAnnotation
    private Long execTime;

    /**
     * 定时任务的自定义属性
     */
    private Map<String, Object> taskAttributes;

    public String getServiceName() {
        return serviceName;
    }

    public void setServiceName(String serviceName) {
        this.serviceName = serviceName;
    }

    public String getCallbackUrl() {
        return callbackUrl;
    }

    public void setCallbackUrl(String callbackUrl) {
        this.callbackUrl = callbackUrl;
    }

    public Long getMemberId() {
        return memberId;
    }

    public void setMemberId(Long memberId) {
        this.memberId = memberId;
    }

    public Long getRoleId() {
        return roleId;
    }

    public void setRoleId(Long roleId) {
        this.roleId = roleId;
    }

    public List<Long> getDataIds() {
        return dataIds;
    }

    public void setDataIds(List<Long> dataIds) {
        this.dataIds = dataIds;
    }

    public Long getExecTime() {
        return execTime;
    }

    public void setExecTime(Long execTime) {
        this.execTime = execTime;
    }

    public Map<String, Object> getTaskAttributes() {
        return taskAttributes;
    }

    public void setTaskAttributes(Map<String, Object> taskAttributes) {
        this.taskAttributes = taskAttributes;
    }
}
